class Juzhen:
    @staticmethod
    def main():
        # 创建一个2x4的Matrix
        matrix1 = [
            [1, 2, 3, 4],
            [5, 6, 7, 8]
        ]

        # 创建一个4X3的矩阵
        matrix2 = [
            [9, 10, 11],
            [12, 13, 14],
            [15, 16, 17],
            [18, 19, 20]
        ]

        rows1 = len(matrix1)
        cols1 = len(matrix1[0])
        cols2 = len(matrix2[0])
        matrix = [[0 for _ in range(cols2)] for _ in range(rows1)]

        # 矩阵乘法
        for i in range(rows1):
            for j in range(cols2):
                for k in range(cols1):
                    matrix[i][j] += matrix1[i][k] * matrix2[k][j]

        for i in range(len(matrix)):
            for j in range(len(matrix[i])):
                print(matrix[i][j], end=" ")
            print()
        print()

        # 矩阵逆置（转置）
        matrix3 = [[0 for _ in range(cols1)] for _ in range(cols2)]
        for i in range(len(matrix3)):
            for j in range(cols1):
                matrix3[i][j] = matrix2[j][i]
                print(matrix3[i][j], end=" ")
            print()


# 调用主方法
if __name__ == "__main__":
    Juzhen.main()